/*
 * Created by SharpDevelop.
 * User: andy
 * Date: 27/10/2006
 * Time: 18:21
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Windows.Forms;

namespace uk.co.aspellclark.todolistppc
{
	/// <summary>
	/// Description of FrmTaskDets.
	/// </summary>
	public partial class FrmTaskDetails
	{
        #region Member Variables
        private DialogResult m_drResult = DialogResult.OK;
        private CTask m_taskDetails = null;
        private System.Drawing.Font m_Font;
		#endregion
        
		
		void FrmTaskDetsResizeEnd(object sender, System.EventArgs e)
		{
            this.Width = Screen.PrimaryScreen.Bounds.Width;
            this.Height = Screen.PrimaryScreen.Bounds.Height;
            if (Screen.PrimaryScreen.Bounds.Width > Screen.PrimaryScreen.Bounds.Height)
            {
                //Landscape();
            }
            else
            {
                //Portrait();
            }
			
		}
        #region Properties

		
        /// <summary>
        /// 
        /// </summary>
        public System.Drawing.Font ctrlFont
        {
            get { return m_Font;  }
            set { m_Font = value;
            	m_tbxTitle.Font = m_Font;
            	m_lblTitle.Font = m_Font;
            	m_lblComments.Font = m_Font;
            	m_tbxComments.Font = m_Font;
            	m_lblComments.Font = m_Font;
            	m_tbxComments.Font = m_Font; }
        }
        /// <summary>
        /// returns the result of the dialog (OK or Cancel) signifying which button was pressed to close the dialog
        /// </summary>
        public DialogResult GetDialogResult
        {
            get { return m_drResult; }
            set { m_drResult = value; }
        }
        /// <summary>
        /// returns the result of the dialog (OK or Cancel) signifying which button was pressed to close the dialog
        /// </summary>
        public CTask TaskDetails
        {
            get { return m_taskDetails; }
            set { m_taskDetails = value; }
        }

        #endregion

        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pTaskDetails"></param>
		public FrmTaskDetails(CTask pTaskDetails)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
            m_taskDetails = pTaskDetails;
		}
		
		
        private void m_btnCancel_Click(object sender, System.EventArgs e)
        {
            m_inputPanel.Enabled = false;
            m_drResult = DialogResult.Cancel;
            this.Close();
        }

        private void m_cmbType_GotFocus(object sender, System.EventArgs e)
        {
            m_inputPanel.Enabled = true;
        }
        
        private void m_inputPanel_EnabledChanged(object sender, System.EventArgs e)
        {
            if (m_inputPanel.Enabled == true)
            {
                this.Height = m_inputPanel.VisibleDesktop.Height;
            }
            else
            {
                this.Height = this.Height - 20;
            }
        }
        
        private void frmTaskDetails_Load(object sender, System.EventArgs e)
        {
            DisplayTaskDetails();
        }

        private void DisplayTaskDetails()
        {
            m_tbxTitle.Text = m_taskDetails.Title;
            m_tbxComments.Text = m_taskDetails.RtfComments;
        }

        private void m_tbxTitle_TextChanged(object sender, System.EventArgs e)
        {
            m_taskDetails.Title = m_tbxTitle.Text;
        }

        private void m_tbxComments_TextChanged(object sender, System.EventArgs e)
        {
            m_taskDetails.RtfComments = m_tbxComments.Text;
        }

        
	}
}
